#include <iostream>
using std::cout;
using std::endl;

class Base {
public:
    /* Base() */
    /* : _base(0) */
    /* { cout << "Base()" << endl; } */

	Base(long base)
    : _base(base)
    { cout << "Base(long)" << endl; }

    ~Base(){
        cout << "~Base()" << endl;
    }
private:
	long _base;
};

class Test{
public:
    Test(long test)
    : _test(test)
    { cout << "Test()" << endl; }

    ~Test(){ cout << "~Test()" << endl; }
private:
    long _test;
};


class Derived
: public Base 
{
public:
	Derived(long base,long derived,long test,long base2)
    : Base(base)//初始化基类子对象时写的基类的类型名称
	, _derived(derived)
    , _t1(test)//初始化成员子对象时写的是对象成员的名字
    , _b1(base2)
	{ cout << "Derived(long)" << endl; }
    
    ~Derived(){
        cout << "~Derived()" << endl;
    }

	long _derived;
    Test _t1;
    Base _b1;//基类类型的对象成员
};

void test0() {
    /* cout << sizeof(Base) << endl; */
    /* cout << sizeof(Derived) << endl; */
	Derived d(1,10,20,49);
}

int main(void){
    test0();
    return 0;
}
